package com.lwj.liwanjia.adapter;

import android.content.Context;

import com.lwj.liwanjia.R;
import com.superrecycleview.superlibrary.adapter.BaseViewHolder;
import com.superrecycleview.superlibrary.adapter.SuperBaseAdapter;

import java.util.List;

/**
 * Created by Administrator on 2017/9/20.
 */

public class KuaiDiAdapter extends SuperBaseAdapter<String> {

    private int checkPosition;
    private Context mContext;

    public void setCheckPosition(int checkPosition) {
        this.checkPosition = checkPosition;
    }

    public KuaiDiAdapter(Context context, List<String> data) {
        super(context, data);
        this.mContext = context;
    }

    @Override
    protected void convert(BaseViewHolder holder, String item, int position) {
        holder.setText(R.id.tv_fangshi, item);
        if (checkPosition == position) {
            holder.setVisible(R.id.iv_xuanzhong, true);
            holder.setTextColor(R.id.tv_fangshi,mContext.getResources().getColor(R.color.colorEC921A));
        } else {
            holder.setVisible(R.id.iv_xuanzhong, false);
            holder.setTextColor(R.id.tv_fangshi,mContext.getResources().getColor(R.color.color454444));
        }
    }

    @Override
    protected int getItemViewLayoutId(int position, String item) {
        return R.layout.kuaidi_item;
    }
}
